In computer science, a virtual machine (VM) is a portion of software that, when executed on appropriate hardware, creates an environment allowing the virtualization of an actual physical computer system. Each VM may function as a self-contained platform, running its own operating system (OS) and software applications (processes). Typically, a virtual machine monitor (VMM) manages allocation and virtualization of computer resources and performs context switching, as may be necessary, to cycle between various VMs.
A host machine (e.g., computer or server) is typically enabled to simultaneously run multiple VMs, where each VM may be used by a local or remote client. The host machine allocates a certain amount of the host's resources to each of the VMs. Each VM is then able to use the allocated resources to execute applications, including operating systems known as guest operating systems. The VMM virtualizes the underlying hardware of the host machine or emulates hardware devices, making the use of the VM transparent to the guest operating system or the remote client that uses the VM.
Often times, a VM will utilize peripheral devices. These peripheral devices may be software that is implemented by the hypervisor for the VM, or hardware devices outside of the hypervisor that are assigned to the VM. For example, peripheral devices may include, but are not limited to, a mouse, graphics card, serial device, or network device.
A current problem with utilizing peripheral devices with VMs is that the hypervisor may stop and/or start a VM at any moment. This stopping and starting is not concurrent with the peripheral device stopping and starting. In other words, when the hypervisor stops a VM, the peripheral devices of that VM are not affected by this change in status. For instance, a peripheral device implemented as software is run on a separate thread than the VM and does not have much information about the VM.
A hardware or software peripheral device may still receive events from a VM or end user and will typically acts on these events regardless of whether the VM is stopped or not. Consequently, the peripheral device may change the VM state (e.g., VM memory) after the VM has stopped. This scenario can cause problems for a VM and the hypervisor, such as complicating debugging because the debugger will not be aware of the changed state of the VM and assumes that VM memory does not change once stopped.